<?php 


/** 
***************************************************
*欢迎使用免费版xSite企业自助建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.php.net.cn/xsite/ 
***************************************************
**/




if(!defined('IN_SITETEAM')) { exit('Access Denied'); } require_once SITE_ROOT . "/include/class.upload.php"; $user_mobi_upload_dir = "{$user_upload_dir}/mobi"; if (!file_exists($user_mobi_upload_dir)) { mkdir($user_mobi_upload_dir); } $settingfile = SITE_ROOT . "/data/setting/{$site_url}/mobi.setting.txt"; $defaultsettingfile = SITE_ROOT . "/data/default.mobi.setting.txt"; $site['mobi_logofile'] = array ( 'form' => 'input', "type" => "file", "name" => "手机网站标志", 'description' => '推荐尺寸：186px × 32px', "class" => "uploadbtn marginbot", 'width' => '200px', 'height' => '18px' ); $site['mobi_banner_ad1'] = array ( 'form' => 'input', "type" => "file", "name" => "手机版首页第一张广告图片", 'description' => '推荐尺寸：400px × 200px', "class" => "uploadbtn marginbot", 'width' => '200px', 'height' => '18px' ); $site['mobi_banner_ad1_name'] = array ( 'form' => 'input', "type"=>"text", "name" => "第一张广告图片的标题", 'description' => '', "class" => "txt", 'width' => '300px', 'height' => '18px' ); $site['mobi_banner_ad1_link'] = array ( 'form' => 'input', "type"=>"text", "name" => "广告图片的链接地址", 'description' => '不填，默认为本网站首页', "class" => "txt", 'width' => '300px', 'height' => '18px' ); $site['mobi_banner_ad2'] = array ( 'form' => 'input', "type" => "file", "name" => "手机版首页第二张广告图片", 'description' => '推荐尺寸：400px × 200px', "class" => "uploadbtn marginbot", 'width' => '200px', 'height' => '18px' ); $site['mobi_banner_ad2_name'] = array ( 'form' => 'input', "type"=>"text", "name" => "第二张广告图片的标题", 'description' => '', "class" => "txt", 'width' => '300px', 'height' => '18px' ); $site['mobi_banner_ad2_link'] = array ( 'form' => 'input', "type"=>"text", "name" => "广告图片的链接地址", 'description' => '不填，默认为本网站首页', "class" => "txt", 'width' => '300px', 'height' => '18px' ); $site['mobi_banner_ad3'] = array ( 'form' => 'input', "type" => "file", "name" => "手机版首页第三张广告图片", 'description' => '推荐尺寸：400px × 200px', "class" => "uploadbtn marginbot", 'width' => '200px', 'height' => '18px' ); $site['mobi_banner_ad3_name'] = array ( 'form' => 'input', "type"=>"text", "name" => "第三张广告图片的标题", 'description' => '', "class" => "txt", 'width' => '300px', 'height' => '18px' ); $site['mobi_banner_ad3_link'] = array ( 'form' => 'input', "type"=>"text", "name" => "广告图片的链接地址", 'description' => '不填，默认为本网站首页', "class" => "txt", 'width' => '300px', 'height' => '18px' ); $site['cat_links'] = array ( 'form' => 'textarea', "name" => "自定义栏目", "class" => "tarea", "description" => "定义栏目格式如下：多个栏目用逗号“,”隔开或者一行一个，举例：<br/><br/>&nbsp;&nbsp;一栏|http://www.xsite.cn<br />&nbsp;&nbsp;二栏|http://www.php.net.cn&nbsp;&nbsp;", 'width' => '300px', 'height' => '100px' ); $site['mobi_open_topad'] = array ( 'form' => 'input', "type" =>"radio", "name" => "是否开启网站顶部小广告", "class" => "txt", "description" => "可选值为：为空或者“1”表示开启，“4”表示关闭，默认为“4”", 'list' => array(1 => '开启', 4 => '关闭'), 'width' => '50px', 'height' => '18px' ); if (!empty($_POST['dosubmit'])) { $savedata = $_POST['data']; if (isset($_POST['del_file']) && is_array($_POST['del_file']) && count($_POST['del_file'])) { if (array_key_exists('mobi_logofile', $_POST['del_file'])) { if (file_exists($savedata['mobi_logofile']) && preg_match("/^attachments/i", $savedata['mobi_logofile'])) @unlink($savedata['mobi_logofile']); $savedata['mobi_logofile'] = ''; } } if (!empty($_FILES['mobi_logofile']['name'])) { $fileinfo = upload_images('mobi_logofile', $user_mobi_upload_dir, 0); if (is_array($fileinfo) && array_key_exists('name', $fileinfo) && array_key_exists('path', $fileinfo)) { if (file_exists($savedata['mobi_logofile']) && preg_match("/^attachments/i", $savedata['mobi_logofile'])) unlink($savedata['mobi_logofile']); $savedata['mobi_logofile'] = str_replace(SITE_DIR . '/', '', "{$fileinfo['path']}{$fileinfo['name']}"); } } if (isset($_POST['del_file']) && is_array($_POST['del_file']) && count($_POST['del_file'])) { if (array_key_exists('mobi_banner_ad1', $_POST['del_file'])) { if (file_exists($savedata['mobi_banner_ad1']) && preg_match("/^attachments/i", $savedata['mobi_banner_ad1'])) @unlink($savedata['mobi_banner_ad1']); $savedata['mobi_banner_ad1'] = ''; } } if (!empty($_FILES['mobi_banner_ad1']['name'])) { $fileinfo = upload_images('mobi_banner_ad1', $user_mobi_upload_dir, 0); if (is_array($fileinfo) && array_key_exists('name', $fileinfo) && array_key_exists('path', $fileinfo)) { if (file_exists($savedata['mobi_banner_ad1']) && preg_match("/^attachments/i", $savedata['mobi_banner_ad1'])) unlink($savedata['mobi_banner_ad1']); $savedata['mobi_banner_ad1'] = str_replace(SITE_DIR . '/', '', "{$fileinfo['path']}{$fileinfo['name']}"); } } if (isset($_POST['del_file']) && is_array($_POST['del_file']) && count($_POST['del_file'])) { if (array_key_exists('mobi_banner_ad2', $_POST['del_file'])) { if (file_exists($savedata['mobi_banner_ad2']) && preg_match("/^attachments/i", $savedata['mobi_banner_ad2'])) @unlink($savedata['mobi_banner_ad2']); $savedata['mobi_banner_ad2'] = ''; } } if (!empty($_FILES['mobi_banner_ad2']['name'])) { $fileinfo = upload_images('mobi_banner_ad2', $user_mobi_upload_dir, 0); if (is_array($fileinfo) && array_key_exists('name', $fileinfo) && array_key_exists('path', $fileinfo)) { if (file_exists($savedata['mobi_banner_ad2']) && preg_match("/^attachments/i", $savedata['mobi_banner_ad2'])) unlink($savedata['mobi_banner_ad2']); $savedata['mobi_banner_ad2'] = str_replace(SITE_DIR . '/', '', "{$fileinfo['path']}{$fileinfo['name']}"); } } if (isset($_POST['del_file']) && is_array($_POST['del_file']) && count($_POST['del_file'])) { if (array_key_exists('mobi_banner_ad3', $_POST['del_file'])) { if (file_exists($savedata['mobi_banner_ad3']) && preg_match("/^attachments/i", $savedata['mobi_banner_ad3'])) @unlink($savedata['mobi_banner_ad3']); $savedata['mobi_banner_ad3'] = ''; } } if (!empty($_FILES['mobi_banner_ad3']['name'])) { $fileinfo = upload_images('mobi_banner_ad3', $user_mobi_upload_dir, 0); if (is_array($fileinfo) && array_key_exists('name', $fileinfo) && array_key_exists('path', $fileinfo)) { if (file_exists($savedata['mobi_banner_ad3']) && preg_match("/^attachments/i", $savedata['mobi_banner_ad3'])) unlink($savedata['mobi_banner_ad3']); $savedata['mobi_banner_ad3'] = str_replace(SITE_DIR . '/', '', "{$fileinfo['path']}{$fileinfo['name']}"); } } if (isset($_POST['del_file']) && is_array($_POST['del_file']) && count($_POST['del_file'])) { if (array_key_exists('mobi_topad', $_POST['del_file'])) { if (file_exists($savedata['mobi_topad']) && preg_match("/^attachments/i", $savedata['mobi_topad'])) @unlink($savedata['mobi_topad']); $savedata['mobi_topad'] = ''; } } if (!empty($_FILES['mobi_topad']['name'])) { $fileinfo = upload_images('mobi_topad', $user_mobi_upload_dir, 0); if (is_array($fileinfo) && array_key_exists('name', $fileinfo) && array_key_exists('path', $fileinfo)) { if (file_exists($savedata['mobi_topad']) && preg_match("/^attachments/i", $savedata['mobi_topad'])) unlink($savedata['mobi_topad']); $savedata['mobi_topad'] = str_replace(SITE_DIR . '/', '', "{$fileinfo['path']}{$fileinfo['name']}"); } } save_array_file($savedata, $settingfile); message("xsite.php?action=mobi&operation=setting", "手机网站设置成功"); } else { if (file_exists($settingfile) && filesize($settingfile) > 0) { $form = read_array_file($settingfile); } else { $form = read_array_file($defaultsettingfile); } if (is_array($form) && count($form) > 0) foreach ($form as $k => $v) { if (array_key_exists($k, $site)) $site[$k]['value'] = $v; } include SITE_ROOT . "/admin/tpl/mobi_setting.tpl.php"; }